package com.example.infomanagesystem.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @author xsp
 */

@Data
public class BaseResponse<T> implements Serializable {

    /**
     * 状态码
     */
    private int status;

    /**
     * 数据
     */
    private T data;

    /**
     * 消息
     */
    private String msg;



    public BaseResponse(int status, T data, String message) {
        this.status = status;
        this.data = data;
        this.msg = message;

    }


    public BaseResponse(int status, T data) {
        this(status, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getStatus(), null, errorCode.getMessage());
    }
}